<!-- <template>
	<view class="home">
		<view class="my-card-container">
			<HeaderNav bgcolor='rgba(255,255,255,.1)' text='绑定企业id' :showNavBackBtn='false' color='#000'></HeaderNav>
		</view>
		<view class="input-info" style="margin-top: 50%;">
			<text class ="login_name">企业id:</text>
			<image class="login_button" src="../../../static/imgs/login.png" style="margin-left: 100rpx;"></image>
			<input class="phone" maxlength="11"/>
		</view>
	
		<view class="input-info">
			<text class ="login_name" style="left: 34%;" @click="bindingId">绑定</text>
			<image class="login_button" style="width: 35%; margin-left: 32%;" src="../../../static/imgs/login.png" ></image>
		</view>
	</view>
</template>

<script>
	import HeaderNav from '@/common/HeaderNav/HeaderNav'
	export default {
		data() {
			return {
			}
		},

		methods: {
			bindingId(){
				console.log('绑定id')
			}
		},components: {
			HeaderNav
		}
	}
</script>

<style lang ="scss" scoped>
	.home{
		width: 100vw;
		height: 100vh;
		background: linear-gradient(0deg ,#021B79,#0b2997,#254dd3);
		.input-info {
			position: relative;
			.login_button {
				width: 75%;
				height: 100rpx;
				margin-top: 20rpx;
				
			}
			
			.login_name{
				position: absolute;
				display: block;
				width: 200rpx;
				left: 160rpx;
				bottom: 35rpx;
				color: #ffffff;
				text-align: right;
				font-size: 38rpx;
				margin-left:-40rpx;
			}
			.phone {
				position: absolute;
				display: block;
				line-height: 100rpx;
				width: 30%;
				left: 300rpx;
				bottom: 30rpx;
				color: #98a2c4;
				margin-left: 50rpx;
				border-bottom: 2rpx solid #b6b6b6;
				text-align: left;
				margin-bottom: 5rpx;
			}
			.code {
				position: absolute;
				display: block;
				width: 35%;
				left: 450rpx;
				bottom: 45rpx;
				color: #98a2c4;
				text-align: left;
				font-size: 28rpx;
			}
		}
	}
</style>
 -->
 <template>
 	<view class="home">
<!-- 		<HeaderNav bgcolor='rgba(248,248,248,.5)' text='授权绑定' :showNavBackBtn='false' color='white'></HeaderNav> -->
 		<view style="width: 100%; height: 90rpx;">
			
		</view>
 		<view class="in">
 			<view class = "title">
 				<view style="line-height:150rpx; height: 130rpx;">
					<view style="position: absolute; top: 10rpx; left:10rpx" >
						<image src="../../../static/icon/left(4).png" style="width: 100rpx; height: 100rpx; margin-top: 20rpx;" @click="BackToCard"></image>
					</view>
 					<view style="position: absolute; left: 80rpx;" >
						<text style="font-size: 42rpx; margin-left: 30rpx;">授权信息填写</text>
					</view>
 				</view>
 			</view>
 <!-- 			<view class = "title">
 				<image class="head-imgs" src="../../../static/imgs/head_image.jpg"></image>
 				<text class ="name">慢慢</text>					
 			</view> -->
<!-- 			<view class="module">
 				<view class="message">
 					<text>企业ID</text>
 				</view>
 			</view>
			<view class="compile" >
 					<textarea v-model="cid" focus="true" auto-height="true" maxlength="20" style=" padding: 25rpx; width: 95%;"></textarea>
 			</view> -->
 		
 			<view class="module">
 				<view class="message">
 					<text>统一社会信用代码</text>
 				</view>
 			</view>
 			<view class="compile" >
 					<textarea v-model="uscc" auto-height="true" maxlength="20" style=" padding: 25rpx; width: 95%;"></textarea>
 			</view>
 			
 			
 			<view class="module">
 				<view class="message">
 					<text>企业邮箱</text>
 				</view>
 			</view>
 			<view class="compile" >
 					<textarea v-model="mail" auto-height="true" maxlength="25" style=" padding: 25rpx; width: 95%;"></textarea>
 			</view>
 			
 			<view class="module">
 				<view class="message">
 					<text>企业地址</text>
 				</view>
 			</view>
 			<view class="compile" >
 					<textarea v-model="address" auto-height="true" maxlength="50" style=" padding: 25rpx; width: 95%;"></textarea>
 			</view>
 			<view class="module">
 				<view class="message">
 					<text>授权码</text>
 				</view>
 			</view>
 			<view class="compile" >
 					<textarea v-model="code" auto-height="true" maxlength="25" style=" padding: 25rpx; width: 95%; "></textarea>
 			</view>
			<view class="compile" style="box-shadow: none !important ; width: 35%; height: 80rpx; margin-left: 35%; margin-top: 50rpx; font-size: 36rpx; border-radius: 50rpx ; ">
				<button @click="authorize" style="height: 80rpx;  line-height: 80rpx; border-radius: 50rpx ; background-color: rgb(79, 94, 114,0.3); color: white; ">确定</button>
			</view>
			
 		</view>
 	</view>
	
 </template>
 
 <script>
 	import HeaderNav from '@/common/HeaderNav/HeaderNav'
	import {authorize as authorizeApi} from '@/api/user'
 	export default {
 		data() {
 			return {
				cid:'',
				uid:'',
 				uscc:'',
 				mail:'',
 				address:'',
				code:'',
 			}
 		},
		onShow(){
			this.cid=this.$store.getters.getUser.cid
			this.uid=this.$store.getters.getUser.uid
		},
 		methods: {
 			BackToCard(){
 				uni.switchTab({
 					url:'/pages/card/card'
 				})
 			},
			async authorize(){
				console.log("cid="+ this.cid)
				console.log("uid="+ this.uid)
				if(this.cid==='' ||this.uscc==''|| this.mail=='' || this.address=='' ||this.code==''){
					uni.showToast({
						title:'请完善授权信息',
						duration:1000,
						icon:"error"
					})
				}else{
					const data ={
						cid:this.cid,
						uid:this.uid,
						uscc:this.uscc,
						mail:this.mail,
						address:this.address,
						code:this.code
					}
					const res = await authorizeApi(data)
					if(res.status === this.API_STATUS_CODE.SUCCESS){
						setTimeout(()=>{
							uni.showToast({
								title:'授权成功',
								duration:1000,
								icon:"success",
							})
						},1000)
						
						this.BackToCard()
					}else{
						uni.showToast({
							title:'授权失败',
							duration:1000,
							icon:"error"
						})
					}
				}
			}
 		},components: {
 			HeaderNav
 		}
 	}
 </script>
 
 <style lang ="scss" scoped>
 	.home {
 		width: 100vw;
 		height: 1700rpx;
 		background: linear-gradient(to top,#172349,#1d2e55,#203f5f,#4f5e72);
 	}
 	
 	.in{
 		width:100%;
 		height: 1600rpx;
 		
 	}
 	.title{
 		position: relative;
 		border-bottom: 3rpx solid #b6b6b6;
 		width: 100%;
 		line-height: 150rpx;
		margin-top: -40rpx;
 		
 		.head-imgs{
 			width: 132rpx;
 			height: 132rpx;
 			border-radius: 50%;
 		}
 		
 		.name{
 			line-height: 100rpx;
 			font-size: 30rpx;
 			position:absolute;
 			/* display: block; */
 			height: 132rpx;
 			width: 132rpx;
 		}
 
 	}
 	.module{
 		width: 100%;
 		height:auto;
 	}
 	.message{
 		width: 90%;
 		height: 60rpx;
 		margin-left: 5%;
 		margin-top: 5%;
 		font-size: 36rpx;
 	}
 	.compile{
 		width: 90%;
 		height: auto;
 		line-height: 60rpx;
 		border-radius: 30rpx;
 		box-shadow: inset 0rpx 0rpx 6rpx 0rpx #ffffff; 
 		margin-top: 20rpx;
 		margin-left: 5%;
 		font-size: 30rpx;
 	}
	text{
		color: white;
	}
	textarea{
		color: white;
		font-size: 32rpx;
	}
 </style>
 